package com.ruoyi.exam.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.exam.mapper.ExamUserOrderMapper;
import com.ruoyi.exam.domain.ExamUserOrder;
import com.ruoyi.exam.service.IExamUserOrderService;

/**
 * 用户订单信息Service业务层处理
 * 
 * @author wky
 * @date 2024-09-19
 */
@Service
public class ExamUserOrderServiceImpl implements IExamUserOrderService {
    @Autowired
    private ExamUserOrderMapper examUserOrderMapper;

    /**
     * 查询用户订单信息
     * 
     * @param userId 用户订单信息主键
     * @return 用户订单信息
     */
    @Override
    public List<ExamUserOrder> selectExamUserOrderByUserId(Long userId) {
        return examUserOrderMapper.selectExamUserOrderByUserId(userId);
    }

    /**
     * 查询用户订单信息列表
     * 
     * @param examUserOrder 用户订单信息
     * @return 用户订单信息
     */
    @Override
    public List<ExamUserOrder> selectExamUserOrderList(ExamUserOrder examUserOrder) {
        return examUserOrderMapper.selectExamUserOrderList(examUserOrder);
    }

    /**
     * 新增用户订单信息
     * 
     * @param examUserOrder 用户订单信息
     * @return 结果
     */
    @Override
    public int insertExamUserOrder(ExamUserOrder examUserOrder) {
        examUserOrder.setCreateTime(DateUtils.getNowDate());
        return examUserOrderMapper.insertExamUserOrder(examUserOrder);
    }

    /**
     * 修改用户订单信息
     * 
     * @param examUserOrder 用户订单信息
     * @return 结果
     */
    @Override
    public int updateExamUserOrder(ExamUserOrder examUserOrder) {
        return examUserOrderMapper.updateExamUserOrder(examUserOrder);
    }

    /**
     * 批量删除用户订单信息
     * 
     * @param userIds 需要删除的用户订单信息主键
     * @return 结果
     */
    @Override
    public int deleteExamUserOrderByUserIds(Long[] userIds) {
        return examUserOrderMapper.deleteExamUserOrderByUserIds(userIds);
    }

    /**
     * 删除用户订单信息信息
     * 
     * @param userId 用户订单信息主键
     * @return 结果
     */
    @Override
    public int deleteExamUserOrderByUserId(Long userId) {
        return examUserOrderMapper.deleteExamUserOrderByUserId(userId);
    }

    public ExamUserOrder getByBatchId(Long batchId) {
        return examUserOrderMapper.selectExamUserOrderByBatchId(batchId);
    }
}
